package com.mini.mysql.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author zhangxiaobin
 * @title: BusinessBaseInfo
 * @description: TODO
 * @date 2019/10/2711:27
 */
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BusinessBaseInfo implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long miniLessonId; //线上初始值 10013566
    @ApiModelProperty(value = "小课业务名称", required = true)
    private String miniLessonName;

    @ApiModelProperty(value = "课程id")
    private String lessonId;

    @ApiModelProperty(value = "课程名称")
    private String lessonName;

    @ApiModelProperty(value = "课程副标题-用做发短信")
    private String lessonSubTitle;

    @ApiModelProperty(value = "渠道id")
    private Integer channelId;

    @ApiModelProperty(value = "渠道标识")
    private String channelCode;

    @ApiModelProperty(value = "渠道名称")
    private String channelName;

    @ApiModelProperty(value = "计划id")
    private String planId;

    @ApiModelProperty(value = "计划名称")
    private String planName;

    @ApiModelProperty(value = "投放地址")
    private String h5url;

    @ApiModelProperty(value = "备注")
    private String comments;

    private Long createUserId;

    private Long updateUserId;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "工作室id", required = true)
    private Long workRoomId;

    @ApiModelProperty(value = "工作室名称", required = true)
    private String workRoomName;

    @ApiModelProperty(value = "负责人id", required = true)
    private Long fzId;

    @ApiModelProperty(value = "负责人名称", required = true)
    private String fzName;

    @ApiModelProperty(value = "短信签名CODE", required = true)
    private String smsSignName;

    @ApiModelProperty(value = "短信模板CODE", required = true)
    private String smsTemplatCode;

    @ApiModelProperty(value = "url来源 1手工填写，2模块化建站", required = true)
    private Integer urlSource;

    @ApiModelProperty(value = "0加盐业务线 1集团业务线", required = true)
    private Integer businessType;

    @ApiModelProperty(value = "公司主体id", required = true)
    private Long companyId;

    @ApiModelProperty(value = "未支付站点", required = true)
    private String unPaySiteId;

    @ApiModelProperty(value = "已支付站点", required = true)
    private String paySiteId;

    @ApiModelProperty(value = "运营组id,逗号分割")
    private String groupIds;

    @ApiModelProperty(value = "运营组名称，逗号分割")
    private String groupNames;

    @ApiModelProperty(value = "分配业务线：1-集团分配，2-小课分配", required = true)
    private Integer assignType;

    @ApiModelProperty(value = "分配类型：0-默认分配，1-公众号分配", required = true)
    private Integer applyTeacherType;

    @ApiModelProperty(value = "公众号分配平台：0-天枢机器人平台，1-飞天公众平台", required = true)
    private Integer pubApplyPlatForm ;

    @ApiModelProperty(value = "公众号id", required = true)
    private String pubAppId;

    @ApiModelProperty(value = "公众号名称", required = true)
    private String pubAppName;

    @ApiModelProperty(value = "组织架构类型 0组 1工作室", required = true)
    private Integer deptType;

    @ApiModelProperty(value = "是否新创建, 1是 0 否")
    @Transient
    private Byte newFlag = 0;

    @ApiModelProperty(value = "待分班标识, 1是 0 否，默认0")
    private Integer dfClassState;

//    传统机会增加字段

    @ApiModelProperty(value = "站点类型 飞天系统 =0，传统=1")
    private Integer siteType = 0;

    @ApiModelProperty(value = "飞天系统目前没有子分类 默认0，传统分为 1:飞天分配 2:星图天网")
    private Integer siteSubType = 0;

    @ApiModelProperty(value = "项目字段id")
    private Integer siteItem;

    @ApiModelProperty(value = "星图站点的模式 A B")
    private String siteModel;

    @ApiModelProperty(value = "星图站点")
    private String xingtuSite;

    @ApiModelProperty(value = "项目名称")
    @Transient
    private String siteItemName;

    @ApiModelProperty(value = "创建来源 ： 0-飞天 1-笛卡尔")
    private Integer buildFrom ;
    @ApiModelProperty(value = "0：飞天系统 传统分为 1:飞天分配 2:星图天网")
    @Transient
    private String siteSubTypeName;

    @ApiModelProperty(value = "sku名字")
    @Transient
    private String skuName;

    @ApiModelProperty(value = "0-非推广类站点 1-推广类站点")
    private Integer channelSelfType;



    @ApiModelProperty(value = "分班类型名称")
    @Transient
    private String dfClassName;

    public String getSiteSubTypeName() {
        if(siteSubType == 1){
            return "飞天分配";
        }else if(siteSubType == 2){
            return "星图天网";
        }else{
            return "无";
        }
    }

    public String getDfClassName() {
        if(assignType != null && dfClassState != null){

            if(dfClassState == 1 && businessType == 0){
                return "后置分班";
            }else if(dfClassState == 0 && businessType == 0){
                return "前置分班";
            }else{
                return "无";
            }
        }else{
            return "无";
        }
    }


}
